/*
 * Copyright ©2017 贾维程. All rights reserved.
 */

package org.handover.repository;
import org.handover.domain.Handover;
import org.handover.domain.Shift;
import org.handover.domain.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Date;
import java.util.List;

public interface HandoverRepository extends JpaRepository<Handover, Long>,JpaSpecificationExecutor {

    boolean existsByDateAndShiftId(Date date, Shift shift);
    boolean existsByIdNotAndDateAndShiftId(Long id, Date date, Shift shift);
    List<Handover> findAllByDateGreaterThanEqualAndDateLessThanEqual(Date beginDate, Date endDate, Sort sort);
    long countByDateGreaterThanEqualAndDateLessThanEqual(Date beginDate, Date endDate);
}
